package com.alexgaoyh.MutiModule.Dubbo.RWSeperate.provider.read.manager.sysman.sysmanUser;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.MutiModule.common.myPage.MyPageView;
import com.MutiModule.common.myPage.util.MyPageViewUtilss;
import com.MutiModule.common.vo.mybatis.pagination.Page;
import com.alexgaoyh.MutiModule.Dubbo.RWSeperate.api.manager.sysman.sysmanUser.read.ISysmanUserReadService;
import com.alexgaoyh.MutiModule.Dubbo.RWSeperate.persist.manager.sysman.sysmanUser.SysmanUser;
import com.alexgaoyh.MutiModule.Dubbo.RWSeperate.persist.manager.sysman.sysmanUser.SysmanUserExample;
import com.alexgaoyh.MutiModule.Dubbo.RWSeperate.persist.manager.sysman.sysmanUser.SysmanUserMapper;

@Service(value = "sysmanUserService")
public class SysmanUserServiceImpl implements ISysmanUserReadService{
	
	@Resource(name = "sysmanUserMapper")
	private SysmanUserMapper mapper;

	@Override
	public int countByExample(SysmanUserExample example) {
		return mapper.countByExample(example);
	}

	@Override
	public List<SysmanUser> selectByExample(SysmanUserExample example) {
		return mapper.selectByExample(example);
	}

	@Override
	public SysmanUser selectByPrimaryKey(Long id) {
		return mapper.selectByPrimaryKey(id);
	}
	
	@Override
	public MyPageView<SysmanUser> generateMyPageViewVO(SysmanUserExample exampleWithOutPage, Page page) {
		
		int _totalCount = mapper.countByExample(exampleWithOutPage);
		
		exampleWithOutPage.setPage(page);
		
		List<SysmanUser> _list = mapper.selectByExample(exampleWithOutPage);
		
		MyPageView<SysmanUser> pageView = new MyPageViewUtilss<SysmanUser>().generaterMyPageView(page.getLength(), page.getPageNo(), _totalCount, _list);
		
		return pageView;
	}

}
